/*
 * is_array.h
 *
 *  Created on: 2009-5-19
 *      Author: toxic
 */

#ifndef IS_ARRAY_H_
#define IS_ARRAY_H_

#include "config.h"

BEGIN_NAMESPACE_TOXIC

struct true_type {};
struct false_type {};

template <bool b>
struct bool_type {
	static const bool value = false;
	typedef false_type type;
};

template <>
struct bool_type<true> {
	static const bool value = true;
	typedef true_type type;
};

template <typename T>
struct is_array: public bool_type<false> {};

template <typename T, size_t N>
struct is_array<T[N]>: public bool_type<true> {};

template <typename T, size_t N>
struct is_array<const T[N]>: public bool_type<true> {};

template <typename T, size_t N>
struct is_array<volatile T[N]>: public bool_type<true> {};

template <typename T, size_t N>
struct is_array<const volatile T[N]>: public bool_type<true> {};

template <typename T>
struct is_array<T[]>: public bool_type<true> {};

template <typename T>
struct is_array<const T[]>: public bool_type<true> {};

template <typename T>
struct is_array<volatile T[]>: public bool_type<true> {};

template <typename T>
struct is_array<const volatile T[]>: public bool_type<true> {};

END_NAMESPACE_TOXIC

#endif /* IS_ARRAY_H_ */
